package com.bluetrum.devicemanager.cmd.payloadhandler;

import androidx.annotation.NonNull;

import com.bluetrum.devicemanager.models.DeviceCapacities;

public class DeviceCapacitiesPayloadHandler extends PayloadHandler<DeviceCapacities> {

    public DeviceCapacitiesPayloadHandler(@NonNull byte[] payload) {
        super(payload);
    }

    @Override
    public DeviceCapacities call() throws Exception {
        final byte[] payload = getPayload();
        if (payload.length == 2) {
            // 小端
            int capacities = (payload[1] << 8) | payload[0];
            return new DeviceCapacities(capacities);
        }
        return null;
    }
}
